<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<html>
<head>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<%@ include file="/WEB-INF/jspf/meta/meta.jspf"%>
<title>校区管理系统--登陆</title>
<%@ include file="/WEB-INF/jspf/adminPage.jspf"%>
 <link href="<%=request.getContextPath()%>/static/_framework/css/bootstrap.min.css" rel="stylesheet">
	<link href="<%=request.getContextPath()%>/static/css/login.css"
	rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="<%=request.getContextPath()%>/static/_framework/jquery/jquery.serializejson.js"></script>
</head>
<script type="text/javascript" src="<%=request.getContextPath()%>/static/_framework/js/bootstrap.min.js"></script>

<script type="text/javascript" charset="utf-8" src="<%=request.getContextPath()%>/static/_framework/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="<%=request.getContextPath()%>/static/_framework/ueditor/ueditor.all.min.js"> </script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="<%=request.getContextPath()%>/static/_framework/ueditor/lang/zh-cn/zh-cn.js"></script>
<style>
	.edui-default .edui-editor-bottomContainer {
		display: none;
		overflow: hidden;
	}
</style>
<body>
	<div id="nitice">
		<div id="editor" type="text/plain" style="width:100%;height:100%;"></div>
	</div>

	<div style="float: left">
		<div style="margin-bottom:10px;"></div>
		&nbsp;&nbsp;<a href="#" id="show"  onclick="show()" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-ok'">查看最新通知</a>

	</div>
	<div class="login_box">
		<div class="login_l_img">
			<img src="<%=request.getContextPath()%>/static/img/login-img.png"  />
		</div>
		<div class="login">
			<div class="login_logo">
				<a href="#"><img
					src="<%=request.getContextPath()%>/static/img/login_logo.png" /></a>
			</div>
			<div class="login_name">
				<p>校区管理系统</p>
			</div>
			<form id="login">
				<input name="username" id="account" type="text" placeholder="账号" >
				<input name="password" type="password" id="password" placeholder="密码" onkeydown="KeyDown()"/>
				<input value="登录" style="width: 100%;" type="button" onclick='login()'>
					<div style="">
					<input
					style="position: absolute; left: 50px; width: 15px; height: 15px;margin-top: 23px;"
					type="checkbox" name="remember"  value="1" lay-skin="primary">
				                    <span style="position: absolute; left: 75px; margin-top: 20px;">记住账号</span>

					<%--<span style="position: absolute;right: 160px;margin-top: 20px">登陆模式选择：</span>--%>
					<%--<select name="type"  style="font-size: 10px; position: absolute;width: 113px;height: 20px;right: 50px;margin-top: 20px;color: black;">--%>
					<%--<option value="学生" >学生登陆</option>--%>
					<%--<option value="教师" >教师登陆</option>--%>
					<%--</select>--%>
		</div>
			</form>
		
			
		</div>
		<div class="copyright" style="margin-top: 300px">青鸟珠海校区
			版权所有©2019 技术支持电话：000-00000000</div>
	</div>
	<script type="text/javascript">
		function KeyDown()
		{
			if (event.keyCode == 13)
			{
				event.returnValue=false;
				event.cancel = true;
				login();
			}
		}


	//异步提交表单
	function check(){
		var username = $('#account').val();
		if(username==""||username==null){
			$.messager.alert("提示","账号不能为空","info")
			return false;
		}
		let password = $('#password').val();
		if(password==""||password==null){
			$.messager.alert("提示","密码不能为空","info")
			return false;
		}
		return true;
	}
	function login(){
		if(check()==true){
				var formData = $("#login").serializeJSON();
				$.ajax({
					url: "<%=request.getContextPath()%>/login/login.json",
					type: "POST",
					data: formData, 	
					success: function (data) {
						if(data.code==0){
							window.location="<%=request.getContextPath()%>/forword/_AdminCenter"
						}
						if(data.code==1){
							$.messager.show({
								title:'操作提示',
								msg:'账号或密码错误',
								timeout:3000,
								showType:'slide'
							});
						}
					}
				});
			}
	}

	$('#nitice').dialog({
		title: '通知',
		width: 600,
		height: 800,
		closed: true,
		modal: true
	});

	$(function () {
		let cookies  = document.cookie;
		if (cookies != '') {
			let account=document.cookie.split(";").find(cookie=>cookie.split("=")[0]=='account').split("=")[1]
			$("#account").val(account);
		}
		ue.addListener( 'ready', function( editor ) {
			ue.setDisabled('fullscreen');
			$.ajax({
				url:path_home+'/notice/get',
				dataType:'json',
				data:{id:-1},
				type:'post',
				success:function(notice){
					ue.setContent(notice.noticeText);
					// ue.setTitle(notice.noticeTitle)
				}
			});
		} );
	})

	const ue = UE.getEditor('editor');

	function show() {
		$('#nitice').dialog('open')
		return false;
	}

	</script>
</body>
</html>